package top.lingkang.potato;

import javafx.application.Application;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import top.lingkang.potato.network.HttpRequest;
import top.lingkang.potato.views.HomeView;
import top.lingkang.potato.views.LoginView;

/**
 * @author lingkang
 * @date 2021/9/17 0:25
 * @description
 */
public class PotatoApplication extends Application {
    @Override
    public void start(Stage stage) throws Exception {
        StateManager.stageManager.put("PotatoApplication", stage);
        stage.getIcons().add(new Image("assets/img/potato.png"));
        // 显示登录
        LoginView loginView = new LoginView();
        StateManager.stageManager.put("LoginView", loginView);
//        HomeView homeView = new HomeView();
//        StateManager.stageManager.put("HomeView", homeView);
//        ResponseResult login = HttpRequest.accountClient.login("123", "123");
//        System.out.println(login);

    }

    @Override
    public void stop() throws Exception {
        System.out.println("top...");
        super.stop();
    }

    @Override
    public void init() throws Exception {
        super.init();
        // 初始化网络配置
        HttpRequest.initHttpRequest();
    }

    public static void main(String[] args) {
        Application.launch(PotatoApplication.class, args);
    }
}
